package com.paradogs.gs.db;

import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnType;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.paradogs.gs.misc.BaseMgrEntity;
import com.paradogs.gs.misc.annotations.CodeAutoGeneratorModule;
import com.paradogs.gs.misc.annotations.NetSyncOwner;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author: yumi
 * @date: 2024/10/23  22:59
 * @Description: 属性
 */
@CodeAutoGeneratorModule("attr")
@Data
@AllArgsConstructor
@ProtobufClass
@TableName(value = "mgr_attr", autoResultMap = true)
public class Attr extends BaseMgrEntity {

    // 最终属性
    @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 1024)
    @TableField(value = "final_attr", typeHandler = Fastjson2TypeHandler.class)
    private Map<Integer, Integer> finalAttr;

    // 属性加成
    @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 1024)
    @TableField(value = "attrs", typeHandler = Fastjson2TypeHandler.class)
    private Map<Integer, Integer> attrs;

    @NetSyncOwner(false)
    @TableField("curHp")
    private Integer curHp;
    @NetSyncOwner(false)
    @TableField("curMp")
    private Integer curMp;

    public Attr() {
        this.finalAttr = new LinkedHashMap<>();
        this.attrs = new LinkedHashMap<>();
        this.curHp = 100;
        this.curMp = 100;
    }

}
